package com.liu.configuration;

import com.liu.interceptor.DmIntercepor;
import com.liu.interceptor.StudentIntercepor;
import com.liu.interceptor.TeacherIntercepor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by liu on 17-11-28.
 */
@Configuration
public class InterceptorConfiguration extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getTeacherIntercepor()).addPathPatterns("/we", "/studemo", "/text",
                "/Addtextdemo","/ruledemo","/cpdemo","/indexdemo","/vote","/addvote","/student",
                "/stuText","/Addtextdemo","/ruledemo","/vote","/addvote","/addvote","/pddemo",
                "/stuVote","/addstudent","/roomStu","/claStu","/stuChange","/teaSelect","/addStu",
                "/voteLook","/heaSelect","/addTea","/xtindex","/addRule","/addHea","/textdemo","/xtChange"
        ,"/xtPerson","/sIndex","/jifen","/xtStudent","/xtHea","/xtRule","/xtJF","/stuJfpm","/stu/sess"
        ,"/getRelativeStu","/checkfom","/grjifen","/checkfomTea","/tea/sess","/addVC/{id}","/testVote/{id}"
        ,"/HVC");
    }

    private TeacherIntercepor getTeacherIntercepor() {
        return new TeacherIntercepor();
    }
}
